package test;

import java.io.IOException;
import java.net.*;

public class 发送端 {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds=new DatagramSocket(3333);
        String str="你好";

        byte[]buff=str.getBytes();
        DatagramPacket dp=new DatagramPacket(buff
                , buff.length
                , InetAddress.getByName("localhost")
                ,6666);

        System.out.println("发送数据——————");
        ds.send(dp);
        ds.close();
    }
}
